Hey all, In my process of comparing two versions of the same module, I want to also compare module-level attributes - I wrote a function to do so.
void compareModuleAttributes(Module newer, Module older) {
ModuleProperties newModProp
ModuleProperties oldModProp
ModuleVersion newModVers
ModuleVersion oldModVers
string attr
newModVers = moduleVersion(newer)
oldModVers = moduleVersion(older)
getProperties(newModVers, newModProp)
getProperties(oldModVers, oldModProp)
for attr in oldModProp do {
bool canMod = canModify(oldModProp.attr)
if (canMod == true) {
print "Attr: " attr "\n"
newProp = newModProp.attr ""
oldModProp.attr = newProp
} else {
print "Can't be modified: " attr "\n"
}
}
}
This works to find the module level variables and check if they're there, but the strange thing related to this is that none of these objects apparently can be modified - without the checks on it DXL throws errors claiming I have no access to those objects. Is anyone familiar with why this could be happening? I have access to each individual module which I am comparing and can successfully modify attributes to individual objects perfectly fine, but in DXL I have no access to module-level attributes. I'm even able to edit them in the GUI perfectly fine. Thanks! cmoughon - Fri Jul 21 09:24:23 EDT 2017 |
Re: Comparing module-level attributes? To modify a module level attribute you need to open the module in edit mode and use the Module handle to modify it. Like this:
AttrDef ad; for ad in older do {
bool isModule = ad.module;
if (isModule) {
string aName = ad.name;
module.aName = "Changed!";
}
}
The module properties (getProperties) can only be used to read the properties of a module without opening it (which is considerably faster than opening the module to read the values). Regards, Mathias |